﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using XBLib.Dal;
using XBLib.Dal.AdoDal;
using XBLib.BusinessObject;
using System.Data.Common;
using DataInfo;

namespace KenLib.Dal
{
    class 他団体実習生情報Dao : BaseAdoDao
    {
        public DataTable Insert他団体実習生情報(string 姓, string 名, bool 性別, DateTime 生年月日, int 国籍, string 出身地, DateTime 入国年月日, DateTime 号移行年月日, int 企業ID)
        {
            DbParameter dbParam1 = _daoHelper.CreateParameter("@姓", 姓, DbType.String);
            DbParameter dbParam2 = _daoHelper.CreateParameter("@名", 名, DbType.String);
            DbParameter dbParam3 = _daoHelper.CreateParameter("@性別", 性別, DbType.Boolean);
            DbParameter dbParam4 = _daoHelper.CreateParameter("@生年月日", 生年月日, DbType.DateTime);
            DbParameter dbParam5 = _daoHelper.CreateParameter("@国籍", 国籍, DbType.Int32);
            DbParameter dbParam6 = _daoHelper.CreateParameter("@出身地", 出身地, DbType.String);
            DbParameter dbParam7 = _daoHelper.CreateParameter("@入国年月日", 入国年月日, DbType.DateTime);
            DbParameter dbParam8 = _daoHelper.CreateParameter("@号移行年月日", 号移行年月日, DbType.DateTime);
            DbParameter dbParam9 = _daoHelper.CreateParameter("@企業ID", 企業ID, DbType.Int32);
            DbCommand dbcommand = _daoHelper.CreateCommand("Insert他団体実習生情報_TUNG", CommandType.StoredProcedure, dbParam1, dbParam2, dbParam3, dbParam4, dbParam5, dbParam6, dbParam7, dbParam8, dbParam9);
            return _daoHelper.Query(dbcommand);
        }
        public DataTable get他団体実習生情報(int 企業ID)
        {
            DbParameter dbParam1 = _daoHelper.CreateParameter("@企業ID", 企業ID, DbType.Int32);
            DbCommand dbcommand = _daoHelper.CreateCommand("sp_get他団体実習生情報_TUNG", CommandType.StoredProcedure, dbParam1);
            return _daoHelper.Query(dbcommand);
        }

        public DataTable Check他団体実習生情報(string 姓, string 名, DateTime 入国年月日, int 企業ID)
        {
            DbParameter dbParam1 = _daoHelper.CreateParameter("@姓", 姓, DbType.String);
            DbParameter dbParam2 = _daoHelper.CreateParameter("@名", 名, DbType.String);
            DbParameter dbParam3 = _daoHelper.CreateParameter("@入国年月日", 入国年月日, DbType.DateTime);
            DbParameter dbParam4 = _daoHelper.CreateParameter("@企業ID", 企業ID, DbType.Int32);
            DbCommand dbcommand = _daoHelper.CreateCommand("sp_Check他団体実習生情報_TUNG", CommandType.StoredProcedure, dbParam1, dbParam2, dbParam3, dbParam4);
            return _daoHelper.Query(dbcommand);
        }


        public DataTable Check_Update_他団体実習生情報(string 姓, string 名, DateTime 入国年月日, int 企業ID, int ID)
        {
            DbParameter dbParam1 = _daoHelper.CreateParameter("@姓", 姓, DbType.String);
            DbParameter dbParam2 = _daoHelper.CreateParameter("@名", 名, DbType.String);
            DbParameter dbParam3 = _daoHelper.CreateParameter("@入国年月日", 入国年月日, DbType.DateTime);
            DbParameter dbParam4 = _daoHelper.CreateParameter("@企業ID", 企業ID, DbType.Int32);
            DbParameter dbParam5 = _daoHelper.CreateParameter("@ID", ID, DbType.Int32);
            DbCommand dbcommand = _daoHelper.CreateCommand("sp_Check他団体実習生情報_Update_TUNG", CommandType.StoredProcedure, dbParam1, dbParam2, dbParam3, dbParam4, dbParam5);
            return _daoHelper.Query(dbcommand);
        }


        public void Update他団体実習生情報(int ID, string 姓, string 名, bool 性別, DateTime 生年月日, int 国籍, string 出身地, DateTime 入国年月日, DateTime 号移行年月日)
        {
            DbParameter dbParam = _daoHelper.CreateParameter("@id", ID, DbType.Int32);
            DbParameter dbParam1 = _daoHelper.CreateParameter("@lastname", 姓, DbType.String);
            DbParameter dbParam2 = _daoHelper.CreateParameter("@fisrtname", 名, DbType.String);
            DbParameter dbParam3 = _daoHelper.CreateParameter("@sex", 性別, DbType.Boolean);
            DbParameter dbParam4 = _daoHelper.CreateParameter("@dob", 生年月日, DbType.DateTime);
            DbParameter dbParam5 = _daoHelper.CreateParameter("@nation", 国籍, DbType.Int32);
            DbParameter dbParam6 = _daoHelper.CreateParameter("@country", 出身地, DbType.String);
            DbParameter dbParam7 = _daoHelper.CreateParameter("@doe", 入国年月日, DbType.DateTime);
            DbParameter dbParam8 = _daoHelper.CreateParameter("@dol", 号移行年月日, DbType.DateTime);
            DbCommand dbcommand = _daoHelper.CreateCommand("Sp_Update他団体実習生情報_TUNG", CommandType.StoredProcedure, dbParam, dbParam1, dbParam2, dbParam3, dbParam4, dbParam5, dbParam6, dbParam7, dbParam8);
            _daoHelper.Execute(dbcommand);
        }

        public DataTable Show_Update_他団体実習生情報(int ID)
        {
            DbParameter dbParam1 = _daoHelper.CreateParameter("@ID", ID, DbType.Int32);
            DbCommand dbcommand = _daoHelper.CreateCommand("sp_SHOW_UPDATE_他団体実習生情報_TUNG", CommandType.StoredProcedure, dbParam1);
            return _daoHelper.Query(dbcommand);
        }

        
    }
}
